package model;

import java.io.File;

/**
 * An object to represent a file associated with the recommendation of a paper.
 * @author Kevin Anderson
 */
public class Recommendation extends Paper{

	/**
	 * Value of a file associated with a recommended paper.
	 */
	public static final String RECOMMENDED = "Recommended";
	
	/**
	 * Value of a file associated with a NOT recommendated paper.
	 */
	public static final String NOT_RECOMMENDED = "NotRecommended";
	
	/**
	 * The ID of the recommendation.
	 */
	private int my_id;
	
	/**
	 * The ID of the manuscript associated with the recommendation.
	 */
	private int my_paperID;
	
	/**
	 * The ID associated with the user assigned as the SPC for this paper.
	 */
	private int my_spcID;
	
	/**
	 * The value, Recommended or Not Recommended, associated with the recommendation.
	 */
	private String my_recValue;
	
	/**
	 * The local file path of the recommendation on the file system.
	 */
	private String my_path;
	
	/**
	 * Constructs a new recommendation.
	 * @param id The ID of the recommendation
	 * @param paperID The ID of the paper associated with the recommendation.
	 * @param spcID The ID of the SPC assigned to this paper.
	 * @param recValue The value (recommended or not recommended) associated with the recommendation.
	 * @param path The file file of the recommendation on the file system.
	 */
	public Recommendation(int id, int paperID, int spcID, String recValue, String path)
	{
		my_id = id;
		my_paperID = paperID;
		my_spcID = spcID;
		my_recValue = recValue;
		my_path = path;
		if(!makeFile())
			System.err.println("Recommendation Failed to make a file!");
	}

	/**
	 * Constructs a {@link File} object using the recommendations file path.
	 * @return <code>true</code>If the file is successfully construted, <code>false</code> otherwise.
	 */	
	public boolean makeFile()
	{
		my_file = new File(my_path);
		if (my_file == null)
			return false;	
		
		return true;
	}

	
	/**
	 * @return The ID of the recommendation.
	 */
	public int getMy_id()
	{
		return my_id;
	}

	/**
	 * @return The ID of the paper associated with this recommendation.
	 */	
	public int getMy_paperID()
	{
		return my_paperID;
	}
	
	/**
	 * @return The ID of the spc assigned to the paper associated with this recommendation.
	 */
	public int getMy_spcID()
	{
		return my_spcID;
	}
	
	/**
	 * @return The local filepath of this recommendation on the file system.
	 */
	public String getMy_path()
	{
		return my_path;
	}

	/**
	 * @return The recommendation value (recommended or not recommended) associated
	 * with this recommendation.
	 */
	public String getMy_recValue() {
		return my_recValue;
	}
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	public String toString()
	{
		return "Recommendation: " + my_id;
	}
}